>>> a = 10.1234
>>> f'{a:.2f}'
'10.12'
>>> a = 10.1234
>>> f'{a:.2f}'
'10.12'
>>> foobar = 3.141592
>>> print(f'My number is {foobar:.2f} - look at the nice rounding!')
My number is 3.14 - look at the nice rounding!
>>> number1 = 10.1234
>>> f'{number1:.2f}'
'10.12'
print "%.2f" % 5